#pragma once

#include <btBulletCollisionCommon.h>
#include <btBulletDynamicsCommon.h>
#include <irrlicht.h>
#include "Game.h"

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

class Game;

class Physics {
public:
	btDiscreteDynamicsWorld *World;
	btDefaultCollisionConfiguration *CollisionConfiguration;
	btBroadphaseInterface *BroadPhase;
	btCollisionDispatcher *Dispatcher;
	btSequentialImpulseConstraintSolver *Solver;
	list<btRigidBody *> Objects;
	Game* game;

	Physics(Game* game);
	
	void CreateStartScene();
	void CreateBox(const btVector3 &TPosition, const vector3df &TScale, btScalar TMass);
	void CreateSphere(const btVector3 &TPosition, btScalar TRadius, btScalar TMass);
	void UpdatePhysics(u32 TDeltaTime);
	void UpdateRender(btRigidBody *TObject);
	void ClearObjects();
	int GetRandInt(int TMax);
};